<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>123111</div>
</body>
<script>
    // 1、1、2、3、5、8、13、21、34
  function fib (n){
      if(n<0) throw new Error("输入值不能小于0")
      if(n<=2){
          return n;
      }
      function _fib(n,a,b){
          if(n===0) return a
            return _fib(n-1,b,a+b)
      }
        return _fib(n,0,1)
  }
console.log(fib(4))
</script>

</html>